package titan.wizards.newBasedComponent;

import org.eclipse.jface.wizard.IWizardPage;
import titan.messages.Messages;
import titan.wizards.BaseTitanWizard;

/**
 *  Wizard to create a new Titan component based on another existent component
 */
public class ComponentWizard extends BaseTitanWizard {
	private ComponentPage componentPage;

	public ComponentWizard() {
		super();
		setNeedsProgressMonitor(true);
		componentPage = new ComponentPage();
	}

	/**
	 * {@inheritDoc}
	 */
	public void init() throws Exception {
		componentPage.loadComponents(project);
	}

	/**
	 * {@inheritDoc}
	 */
	public void addPages() {
		addPage(componentPage);
	}

	/**
	 * {@inheritDoc}
	 */
	public IWizardPage getFirstPage() {
		return componentPage;
	}

	/**
	 * {@inheritDoc}
	 */
	public boolean performFinish() {
		return componentPage.copySelectedComponent();
	}

	/**
	 * {@inheritDoc}
	 */
	public boolean canFinish() {
		return componentPage.canFinish();
	}

	/**
	 * {@inheritDoc}
	 */
	public String getWindowTitle() {
		return new String(Messages.NewComponent);
	}
}